import { request } from "@/utils/request";

// 获取分类数据
export function getCategoryList() {
  return request.post<{ classList: API.Category[] }>(
    "/api/product/getCategoryList",
    null,
    {
      params: { pid: 1004 },
    }
  );
}

// 获取品牌数据
export function getBrandList(classId: string) {
  return request.post<{ brandList: API.Brand[] }>(
    "/api/product/getBrandList",
    null,
    {
      params: { pid: 1004, pageSize: 100, classId },
    }
  );
}

// 获取产品数据
export function getProductList(
  classId: string,
  brandId: string,
  pageIndex: number,
  pageSize: number
) {
  return request.post<{ productList: API.Product[]; pageInfo: API.PageInfo }>(
    "/api/product/getProductList",
    null,
    {
      params: {
        pid: 1004,
        seriesId: 0,
        classId,
        brandId,
        pageIndex,
        pageSize,
      },
    }
  );
}

// 获取产品问题详情
export function getEvaluateParam(productId: string) {
  return request.post<API.EvaluateParam>(
    "/api/product/getEvaluateParam",
    {
      productId,
    },
    {
      params: { pid: 1004 },
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
    }
  );
}
